package com.yifeng.repo.base.mdm;

import com.gomcarter.frameworks.base.common.AssertUtils;
import com.yifeng.base.account.api.AdmOrgMasterDataRestService;
import com.yifeng.base.account.api.OpsOrgMasterDataRestService;
import com.yifeng.base.account.api.UserMasterDataRestService;
import com.yifeng.base.bds.api.store.StoreMasterDataRestService;
import com.yifeng.repo.base.utils.common.BaseUtil;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

/**
 * Created by daibing on 2024/1/30.
 */
@Slf4j
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class MasterDataManager {
    private UserMasterDataRestService userMasterDataRestService;
    private AdmOrgMasterDataRestService admOrgMasterDataRestService;
    private OpsOrgMasterDataRestService opsOrgMasterDataRestService;
    private StoreMasterDataRestService storeMasterDataRestService;

    public void init() {
        log.info("yfcloud MasterDataManager init success: OWNER_ID={}, OWNER_NAME={}", BaseUtil.OWNER_ID, BaseUtil.OWNER_NAME);
    }

    public void destroy() {
        log.info("yfcloud MasterDataManager destroy success: OWNER_ID={}, OWNER_NAME={}", BaseUtil.OWNER_ID, BaseUtil.OWNER_NAME);
    }

    public UserMasterDataRestService getUserMasterDataRestService() {
        AssertUtils.notNull(userMasterDataRestService, "未设置员工服务！");
        return userMasterDataRestService;
    }

    public AdmOrgMasterDataRestService getAdmOrgMasterDataRestService() {
        AssertUtils.notNull(admOrgMasterDataRestService, "未设置行政组织服务！");
        return admOrgMasterDataRestService;
    }

    public OpsOrgMasterDataRestService getOpsOrgMasterDataRestService() {
        AssertUtils.notNull(opsOrgMasterDataRestService, "未设置营运组织服务！");
        return opsOrgMasterDataRestService;
    }

    public StoreMasterDataRestService getStoreMasterDataRestService() {
        AssertUtils.notNull(storeMasterDataRestService, "未设置门店服务！");
        return storeMasterDataRestService;
    }

}
